import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', {
  state: () => {
    return {
      token: '',
      isCollapse: true,
      userName: sessionStorage.getItem('userName'),
      taskArrayData: [],
      statuCount: 0,
      flag: false
    }
  },
  getters: {

  },
  actions: {
    setIsCollapse(data) {
      this.isCollapse = data
    },
    setToken(data) {
      this.token = data
      sessionStorage.setItem('token', this.token)
    },
    setUserName(data) {
      this.userName = data
      sessionStorage.setItem('userName', this.userName)
    },
    setTaskArray(data) {
      this.taskArrayData = data

    },
    setUserId(data) {
      this.userId = data
      sessionStorage.setItem('userId', this.userId)
    },
    setStatuCount(data) {
      console.log(data)
      this.statuCount = data
      localStorage.setItem('statuCount', this.statuCount)
    },
    setFlag(data) {
      console.log(data)
      this.flag = data
      sessionStorage.setItem('flag', this.flag)
    },
  }
})
